package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Sign;
import cn.wolfcode.trip.base.mapper.SignMapper;
import cn.wolfcode.trip.base.service.ISignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class SignServiceImpl implements ISignService {
    @Autowired
    private SignMapper signMapper;

    @Override
    public Sign list(Long userId) {

        return signMapper.selectByPrimaryKey(userId);
    }

    @Override
    public void saveOrUpdate(Sign sign) {
        Sign user = signMapper.selectByPrimaryKey(sign.getUserId());
        if(user!=null){
            signMapper.updateByPrimaryKey(sign);
        }else {
            signMapper.insert(sign);
        }
    }
}
